import pandas as pd


def write_to_excel_with_pandas(file_path, data):
    df = pd.DataFrame(data)
    try:
        df.to_excel(file_path, index=False)
        print(f"数据已成功写入 {file_path}")
    except Exception as e:
        print(f"写入Excel文件时发生错误: {e}")


# 示例数据，这里是一个字典列表
data = [
    {'Name': 'Alice1', 'Age': 20},
    {'Name': 'Bob1', 'Age': 33},
    {'Name': 'Charlie1', 'Age': 25},
]
file_path = 'f://12.xlsx'
write_to_excel_with_pandas(file_path, data)